Skip to content

Fix #9775: Fix primitive-in-condition handling in backend #9827

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 22, 2020

Conversation

smarter
Copy link
Member

@smarter smarter commented Sep 18, 2020

isPrimitive/getPrimitive are overloaded: they both have a version which
takes a symbol as input and a version which takes a tree, the latter can
handle array get and set primitives which map to different JVM
instructions depending on their type, but we don't care about that when
emitting conditions in genCond: we only need to look for primitives
which correspond to boolean operations and those are already handled by
the symbol versions of isPrimitive/getPrimitive. By using these methods
in genCond we avoid running some unnecessary code and we fix #9775 which
was triggered because the getPrimitive overload we were using required
forcing lhs. This change also aligns us with what the scalac backend
does.

isPrimitive/getPrimitive are overloaded: they both have a version which
takes a symbol as input and a version which takes a tree, the latter can
handle array get and set primitives which map to different JVM
instructions depending on their type, but we don't care about that when
emitting conditions in genCond: we only need to look for primitives
which correspond to boolean operations and those are already handled by
the symbol versions of isPrimitive/getPrimitive. By using these methods
in genCond we avoid running some unnecessary code and we fix scala#9775 which
was triggered because the `getPrimitive` overload we were using required
forcing `lhs`. This change also aligns us with what the scalac backend
does.
@nicolasstucki nicolasstucki merged commit f9e2428 into scala:master Sep 22, 2020
@nicolasstucki nicolasstucki deleted the backend-getPrimitive branch September 22, 2020 14:06
@Kordyjan Kordyjan added this to the 3.0.0 milestone Aug 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

MatchError Trees$TypeApply
3 participants